package com.sunny.ihealth.entity.app;

import android.text.TextUtils;

import com.sunny.ihealth.entity.bmob.UserInfo;

import java.io.Serializable;

import cn.bmob.v3.datatype.BmobFile;

/**
 * SharedPreferences 中存储的 用户资料数据结构
 * Created by Sunny  An on 2016/5/15.
 */
public class SPUserInfo implements Serializable {
    private String username;
    private String password;
    private String nickname;
    private String signature;
    private boolean gender;
    private String headFileName;
    private String headUrl;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public boolean getGender() {
        return gender;
    }

    public void setGender(boolean gender) {
        this.gender = gender;
    }

    public String getHeadFileName() {
        return headFileName;
    }

    public void setHeadFileName(String headFileName) {
        this.headFileName = headFileName;
    }

    public String getHeadUrl() {
        return headUrl;
    }

    public void setHeadUrl(String headUrl) {
        this.headUrl = headUrl;
    }


    public UserInfo getUserInfo() {
        UserInfo userInfo = new UserInfo();
        userInfo.setNickname(nickname);
        userInfo.setSignature(signature);
        userInfo.setGender(gender);
        BmobFile bmobFile = new BmobFile();
        bmobFile.setUrl(headUrl);
        userInfo.setHeadFile(bmobFile);
        return userInfo;
    }



    public boolean hasHead() {
        return !TextUtils.isEmpty(headUrl);
    }
}

